<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('我接听的来电')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="post-form">
                <div class="select-list">
                    <ul>
                        <li>
                            流水号：<input type="text" name="wsCode"/>
                        </li>
                        <li>
                            来电号码：<input type="text" name="fromTelA"/>
                        </li>
                        <li>
                            来电人：<input type="text" name="fromName"/>
                        </li>
                        <li>
                            地区名称：<input type="text" name="fmAreaName"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">

            <a class="btn btn-primary single disabled" onclick="$.operate.editTab()"
               shiro:hasPermission="mTelRcd:edit:view">
                <i class="fa fa-edit"></i> 修改
            </a>
            <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()"
               shiro:hasPermission="mTelRcd:remove:view">
                <i class="fa fa-remove"></i> 删除
            </a>

        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('mTelRcd:edit:view')}]];
    var removeFlag = [[${@permission.hasPermi('mTelRcd:remove:view')}]];
    var datas = [[${@dict.getType('sys_normal_disable')}]];
    var prefix = ctx + "system/mTelRcd";

    $(function () {
        var options = {
            url: prefix + "/myGetList",
            updateUrl: prefix + "/processEdit/{id}",
            removeUrl: prefix + "/remove",
            sortName: "pkid",
            sortOrder: "desc",
            uniqueId: "pkId",
            modalName: "我接听的来电",
            columns: [{
                checkbox: true
            },
                {field: 'wsCode', title: '流水号', align: 'left', halign: 'center', sortable: true},
                {field: 'liftTelNo', title: '分机号', align: 'center', halign: 'center'},
                {field: 'liftWorker', title: '接听人', align: 'center', halign: 'center'},
                {field: 'fmAreaName', title: '地区', align: 'center', sortable: true},
                {field: 'fromTelA', title: '来电号码', align: 'left', halign: 'center', sortable: true},
                {field: 'fromName', title: '来话人', align: 'center', sortable: true},
                {field: 'fromTime', title: '接听时间', align: 'center', sortable: true},
                {
                    field: 'stateFlag', title: '当前状态', hidden: true,
                    formatter: function (value, row, index) {
                        return fmtTelGetState(value, row, index);
                    }
                },
                {
                    field: 'hideTel', title: '电话是否隐藏', align: 'center', sortable: true, formatter: function (value) {
                        return value == 5 ? '是' : '否';
                    }
                },
                {field: 'myDesc', title: '备注', align: 'left', halign: 'center'},
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.editTab(\'' + row.pkId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.pkId + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });
    function fmtTelGetState(value, row, index) {
        var rtn = value;
        var myVal = parseInt(value);
        switch (myVal) {
            case 101:
                rtn = '<div class="spDGray">草稿</div>';
                break;
            case 120:
                rtn = '<div class="spOrange">转后台</div>';
                break;
            case 121:
                rtn = '<div class="spOrange">退回坐席</div>';
                break;
            case 122:
                rtn = '<div class="spLBlue">后台处理中</div>';
                break;
            case 125:
                rtn = '<div class="spBlue">生成工单</div>';
                break;
            case 131:
                rtn = '<div class="spLBlue">话务员办结</div>';
                break;
            case 132:
                rtn = '<div class="spLRed">无效来电</div>';
                break;
            case 135:
                rtn = '<div class="spLRed">值班长作废</div>';
                break;
            case 136:
                rtn = '<div class="spLBlue">值班长办结</div>';
                break;

            default:
                break;
        }
        return rtn;
    }
</script>
</body>
</html>